<?php
class LocationModel extends RelationModel{
	/*
	 * 定义关联关系
	 */
	public $_link=array(
		'school'=>array(
			'mapping_type'=> MANY_TO_MANY,
			'class_name'=> 'school',
			'foreign_key'=>'location_id',
			'relation_foreign_key'=>'school_id',
			'relation_table'=>'agl_school_location',
		),
		
		'tweets'=>array(
			'mapping_type'=> HAS_MANY,
			'class_name'=> 'tweets',
			'foreign_key'=>'location_id',
		),
	
		'user_follow'=>array(
			'mapping_type'=> MANY_TO_MANY,
			'class_name'=> 'user',
			'foreign_key'=>'location_id',
			'relation_foreign_key'=>'user_id',
			'relation_table'=>'agl_user_follow_location',
		),
	);
	
	/*
	 * 表单数据验证 
	 */
	protected $_validate=array(
		array('location_name','require','请填写地点名称!',1),
	);
	/*
	 * 数据自动完成 
	 */
	protected $_auto=array(
		array('create_time','time',1,'function'),
	);

	/*
	 * 表单项与字段的映射
	 */
}
?>
